﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Forms;

namespace CryForLua_wpf_AvEd.UserPreferences
{
    /// <summary>
    /// Interaktionslogik für UserPreferences.xaml
    /// </summary>
    public partial class UserPreferencesWindow : Window
    { 
        public UserPreferencesWindow()
        {
            InitializeComponent();
            
            UserPreferencesData.Instance.ReadUserSettingsFromFile();

            this.HtmDirTextBox.Text = UserPreferencesData.Instance.htmFilesDir;
        }

        private void OnBrowseDirsClicked(object sender, RoutedEventArgs e)
        {
            FolderBrowserDialog dialog = new FolderBrowserDialog();

            dialog.ShowDialog();

            this.HtmDirTextBox.Text = dialog.SelectedPath;
            UserPreferencesData.Instance.htmFilesDir = dialog.SelectedPath;
        }

        private void OnSaveButtonClicked(object sender, RoutedEventArgs e)
        {
            UserPreferencesData.Instance.SafePreferencesToFile();
            this.Hide();
        }

        private void OnCancelClicked(object sender, RoutedEventArgs e)
        {
            this.Hide();
        }
 
    }
}
